package com.xbongbong.paas.help;

import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.parent.help.CommonPermissionHelp;
import com.xbongbong.pro.permission.pojo.dto.VerifyUpdatePermissionDTO;
import com.xbongbong.pro.permission.pojo.dto.VerifyViewPermissionDTO;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 详情(查看)权限帮助类
 *
 * @author LiZhikang
 * @date 2023/3/10 10:14
 */
@Component
public class DetailPermissionHelp {

    @Resource
    private CommonPermissionHelp commonPermissionHelp;

    /**
     * 校验团队权限
     *
     * @param verifyViewPermissionDTO
     * @return 有权限true,没权限false
     * @throws XbbException
     */
    public boolean checkPermission(VerifyViewPermissionDTO verifyViewPermissionDTO) throws XbbException {
        VerifyUpdatePermissionDTO verifyUpdatePermissionDTO = new VerifyUpdatePermissionDTO(verifyViewPermissionDTO.getLoginUser(), verifyViewPermissionDTO.getPaasFormDataEntityExt());
        return commonPermissionHelp.checkPermission(verifyUpdatePermissionDTO);
    }

    public boolean checkPermission(VerifyUpdatePermissionDTO verifyUpdatePermissionDTO) throws XbbException{
        return commonPermissionHelp.checkPermission(verifyUpdatePermissionDTO);
    }
}
